package com.alex.formates;

import java.io.File;
import java.util.Vector;

import com.alex.books.BaseBook;
import com.alex.books.Chapter;
import com.alex.books.ReaderingInfo;

public abstract class ReaderPlugin {

	protected Vector<String> mLines = new Vector<String>();
	
	/**
	 * 阅读书的基本信息
	 */
	protected BaseBook mBaseBook;
	
	/**
	 * 阅读时的阅读格式
	 */
	protected ReaderFormat mReaderFormate;
	
	
	/**
	 * 设置阅读格式
	 * @param readerFormate
	 */
	public void setReaderFormat(ReaderFormat readerFormate){
		mReaderFormate = readerFormate;
	}
	
	/**
	 * 获取基本阅读格式信息
	 * @return
	 */
	public ReaderFormat gerReaderFormat(){
		return mReaderFormate;
	}
	
	public void setBook(BaseBook book){
		mBaseBook = book;
	}
	/**
	 * 获取书本基本信息
	 * @return
	 */
	public BaseBook getBook(){
		return mBaseBook;
	}
	
	/**
	 * 获取当前章节
	 * @return
	 */
	public Chapter getCurChapter(){
		return mBaseBook.mReaderingInfo.mCurChapter;
	}
	
	/**
	 * 设置正在阅读的信息
	 * @param readeringInfo
	 */
	public void setReaderingInfo(ReaderingInfo readeringInfo){
		mBaseBook.mReaderingInfo = readeringInfo;
	}
	
	/**
	 * 生成目录
	 * @param book
	 * @param file
	 * @param mode
	 * @return
	 */
	public abstract Object generatedCatalog(BaseBook book,File file,int mode);
	
	/**
	 * 解析书本
	 * @param Book
	 * @param file
	 * @return
	 */
	public abstract Object decode(BaseBook Book,File file);
	
	/**
	 * 获取下一章数据
	 * @return
	 */
	public abstract String nextChapter();
	
	/**
	 * 获取上一章数据
	 * @return
	 */
	public abstract String previousChapter();
	
	/**
	 * 获取下一页数据
	 * @return
	 */
	public abstract String nextPage();
	
	/**
	 * 刷新当前页数据
	 * @return
	 */
	public abstract String refreshPage();
	
	/**
	 * 获取上一页数据
	 * @return
	 */
	public abstract String previousPage();
	
	/**
	 * 是否是最后一页
	 * @return
	 */
	public abstract boolean isLastPage();
	
	/**
	 * 是否是第一页
	 * @return
	 */
	public abstract boolean isFirstPage();
	
	/**
	 * 是否是最后一章
	 * @return
	 */
	public abstract boolean isLastChapter();
	
	/**
	 * 是否是第一章
	 * @return
	 */
	public abstract boolean isFirstChapter();
	
	public Vector<String> getLines(){
		return mLines;
	}
}
